package lab02.test20;

import java.util.Scanner;

/**
 * Created by 婷婷 on 2017/11/1.
 */
public class Test20 {
    public static void main(String[] args) {
        System.out.println("请输入含有字母和数字的字符串");

        //从键盘获取用户输入的字符串
        Scanner userInput = new Scanner(System.in);

        //将字符串赋值给characterString
       String characterString = userInput.next();

        //将字符串的字符存进数组
        char[] chars = characterString.toCharArray();
        System.out.println("该字符串仅输出全部数字的结果是：");

        //用for遍历数组
        for (int i = 0;i<chars.length;i++){

            //如果数组里的字符是数字，就输出打印
            if (chars[i]>='0'&&chars[i]<='9'){
                System.out.print(chars[i]);
            }
        }
    }
}
